# 搜索插入位置


class Solution:
    def searchInsert(self, nums, target):
        # 闭区间写法
        left, right = 0, len(nums) - 1
        while left <= right:
            mid = (left + right) // 2
            if nums[mid] < target:
                left = mid + 1

            else:
                right = mid - 1

        return left



if __name__ == "__main__":

    a = [1,3,5,6]
    sol = Solution()
    res = sol.searchInsert(a, 0)
    print(res)
    



